package com.utils{
	/**
	 * 创建者：薛恒杰
	 * 工程名称：Marbles
	 * 创建时间：Jul 30, 2012 12:21:58 PM
	 * 类说明：Arrow.as,
	 */
	import flash.display.Sprite;
	import flash.geom.Point;
	
	public class Arrow2 extends Sprite{
		public const tensile:Number = 100;
		
		public var speed:Number;
		public var _angle:Number; 
		public function Arrow2()
		{
			super();
			mouseEnabled = false;
		}
		public function setAngle(x:Number, y:Number):void{
			_angle = Physical.Point2Angle(new Point(y, -x), new Point()) - 90;
			var length:Number = Math.min(Point.distance(new Point(), new Point(x, y)), tensile);
			if (_angle < 0 )_angle += 360;
			if (_angle > 360 )_angle -= 360;
			rotation = _angle;
			graphics.clear();
			graphics.beginFill(0x00ff00);
			graphics.drawRect(0, 0, length, 5);
			graphics.endFill();
			speed = length/tensile * 10;
		}
		public function get angle():Number{
			return ( _angle * Math.PI / 180);
		}
	}
}